package ee.siimkaspar.subjects.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;

@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Entity
@Table(name = "employee")
public class Employee implements Serializable, ModelInterface {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "employee", unique = true, nullable = false)
	private Integer id;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "person_fk")
	private Person person;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "enterprise_fk")
	private Enterprise enterprise;
	@Column(name = "struct_unit_fk")
	private Integer structUnitFk;
	@Column(name = "active", length = 1)
	private String active;
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "employeeBySubjectFk")
	private List<UserAccount> userAccountsForSubjectFk = new ArrayList<UserAccount>();
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "employee")
	private List<EmployeeRole> employeeRoles = new ArrayList<EmployeeRole>();
	
	public Employee() {
	}
	
	public Employee(Enterprise enterprise) {
		this.enterprise = enterprise;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Person getPerson() {
		return this.person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public Enterprise getEnterprise() {
		return this.enterprise;
	}

	public void setEnterprise(Enterprise enterprise) {
		this.enterprise = enterprise;
	}

	public Integer getStructUnitFk() {
		return this.structUnitFk;
	}

	public void setStructUnitFk(Integer structUnitFk) {
		this.structUnitFk = structUnitFk;
	}

	public String getActive() {
		return this.active;
	}

	public void setActive(String active) {
		this.active = active;
	}

	public List<UserAccount> getUserAccountsForSubjectFk() {
		return userAccountsForSubjectFk;
	}

	public void setUserAccountsForSubjectFk(
			List<UserAccount> userAccountsForSubjectFk) {
		this.userAccountsForSubjectFk = userAccountsForSubjectFk;
	}

	public List<EmployeeRole> getEmployeeRoles() {
		return employeeRoles;
	}

	public void setEmployeeRoles(List<EmployeeRole> employeeRoles) {
		this.employeeRoles = employeeRoles;
	}
	@Override
	public boolean validate() {
		// TODO Auto-generated method stub
		return true;
	}
}
